Skip to content

Commit

Permalink
switch to using ava
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbrignull committed May 13, 2020
1 parent 0347b72 commit 572c8bb
Show file tree
Hide file tree
Showing 10 changed files with 304 additions and 48 deletions.
29 changes: 29 additions & 0 deletions lib/analysis-paths.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions lib/external-queries.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

156 changes: 156 additions & 0 deletions lib/fingerprints.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions lib/util.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
"description": "CodeQL action",
"scripts": {
"build": "tsc",
"test": "jest",
"test": "ava src/**",
"lint": "tslint -p . -c tslint.json 'src/**/*.ts'",
"removeNPMAbsolutePaths": "removeNPMAbsolutePaths . --force"
},
"ava": {
"typescript": {
"rewritePaths": {
"src/": "lib/"
}
}
},
"license": "MIT",
"dependencies": {
"@actions/core": "^1.0.0",
Expand Down
16 changes: 9 additions & 7 deletions src/analysis-paths.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import test from 'ava';

import * as analysisPaths from './analysis-paths';
import * as configUtils from './config-utils';

test("emptyPaths", async () => {
test("emptyPaths", async t => {
let config = new configUtils.Config();
analysisPaths.includeAndExcludeAnalysisPaths(config, []);
expect(process.env['LGTM_INDEX_INCLUDE']).toBeUndefined();
expect(process.env['LGTM_INDEX_EXCLUDE']).toBeUndefined();
t.is(process.env['LGTM_INDEX_INCLUDE'], undefined);
t.is(process.env['LGTM_INDEX_EXCLUDE'], undefined);
});

test("nonEmptyPaths", async () => {
test("nonEmptyPaths", async t => {
let config = new configUtils.Config();
config.paths.push('path1', 'path2');
config.pathsIgnore.push('path3', 'path4');
analysisPaths.includeAndExcludeAnalysisPaths(config, []);
expect(process.env['LGTM_INDEX_INCLUDE']).toEqual('path1\npath2');
expect(process.env['LGTM_INDEX_EXCLUDE']).toEqual('path3\npath4');
});
t.is(process.env['LGTM_INDEX_INCLUDE'], 'path1\npath2');
t.is(process.env['LGTM_INDEX_EXCLUDE'], 'path3\npath4');
});
5 changes: 3 additions & 2 deletions src/external-queries.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import test from 'ava';
import * as fs from "fs";
import * as path from "path";

import * as configUtils from "./config-utils";
import * as externalQueries from "./external-queries";
import * as util from "./util";

test("checkoutExternalQueries", async () => {
test("checkoutExternalQueries", async t => {
let config = new configUtils.Config();
config.externalQueries = [
new configUtils.ExternalQuery("github/codeql-go", "df4c6869212341b601005567381944ed90906b6b"),
Expand All @@ -16,6 +17,6 @@ test("checkoutExternalQueries", async () => {
await externalQueries.checkoutExternalQueries(config);

// COPYRIGHT file existed in df4c6869212341b601005567381944ed90906b6b but not in master
expect(fs.existsSync(path.join(tmpDir, "github", "codeql-go", "COPYRIGHT"))).toBeTruthy();
t.true(fs.existsSync(path.join(tmpDir, "github", "codeql-go", "COPYRIGHT")));
});
});
Loading

0 comments on commit 572c8bb

Please sign in to comment.