Skip to content

Commit 70a01a6

Browse files
committed
Move test fixtures into __fixtures__ directories
1 parent 52f9fd7 commit 70a01a6

72 files changed

Lines changed: 75 additions & 96 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
// https://github.com/facebook/jest/issues/5274
1010
"!<rootDir>/src/tstl.ts",
1111
],
12-
watchPathIgnorePatterns: ["cli/watch/[^/]+$", "src/lualib"],
12+
watchPathIgnorePatterns: ["cli/__fixtures__", "src/lualib"],
1313
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
1414

1515
setupFilesAfterEnv: ["<rootDir>/test/setup.ts"],

test/cli/run.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import * as path from "path";
33

44
jest.setTimeout(20000);
55

6-
const cliPath = path.join(__dirname, "../../src/tstl.ts");
6+
export const resolveFixture = (name: string) => path.resolve(__dirname, "__fixtures__", name);
77

8+
const cliPath = path.join(__dirname, "../../src/tstl.ts");
89
const defaultArgs = ["--skipLibCheck", "--types", "node"];
910
export function forkCli(args: string[]): ChildProcess {
1011
return fork(cliPath, [...defaultArgs, ...args], {

test/cli/watch.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as fs from "fs-extra";
2-
import * as path from "path";
3-
import { forkCli } from "./run";
2+
import { forkCli, resolveFixture } from "./run";
43

54
let testsCleanup: Array<() => void> = [];
65
afterEach(() => {
@@ -26,7 +25,7 @@ function forkWatchProcess(args: string[]): void {
2625
testsCleanup.push(() => child.kill());
2726
}
2827

29-
const watchedFile = path.join(__dirname, "./watch/watch.ts");
28+
const watchedFile = resolveFixture("watch/watch.ts");
3029
const watchedFileOut = watchedFile.replace(".ts", ".lua");
3130

3231
afterEach(() => fs.removeSync(watchedFileOut));
@@ -48,17 +47,17 @@ async function compileChangeAndCompare(filePath: string, content: string): Promi
4847
}
4948

5049
test("should watch single file", async () => {
51-
forkWatchProcess([path.join(__dirname, "./watch/watch.ts")]);
50+
forkWatchProcess([resolveFixture("watch/watch.ts")]);
5251
await compileChangeAndCompare(watchedFile, "const value = 1;");
5352
});
5453

5554
test("should watch project", async () => {
56-
forkWatchProcess(["--project", path.join(__dirname, "./watch")]);
55+
forkWatchProcess(["--project", resolveFixture("watch")]);
5756
await compileChangeAndCompare(watchedFile, "const value = 1;");
5857
});
5958

6059
test("should watch config file", async () => {
61-
const configFilePath = path.join(__dirname, "./watch/tsconfig.json");
60+
const configFilePath = resolveFixture("watch/tsconfig.json");
6261
forkWatchProcess(["--project", configFilePath]);
6362
await compileChangeAndCompare(configFilePath, '{ "tstl": { "luaTarget": "5.3" } }');
6463
});
File renamed without changes.

test/translation/transformation/characterEscapeSequence.ts renamed to test/translation/__fixtures__/characterEscapeSequence.ts

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)