Skip to content

Commit

Permalink
[extras] snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpza committed Aug 19, 2024
1 parent 98f2d32 commit cf296bb
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test/tests/extras.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ describe(`Extra Tests`, () => {
describe(`Built Tests`, () => {
// see: https://github.com/LeDDGroup/typescript-transform-paths/issues/130
test(`Transformer works without ts-node being present`, () => {
jest.doMock(
"ts-node",
() => {
throw new ModuleNotFoundError("ts-node");
},
{ virtual: true },
);
jest.doMock("ts-node", () => {
throw new ModuleNotFoundError("ts-node");
});
try {
const program = createTsProgram({ tsInstance: ts, tsConfigFile }, config.builtTransformerPath);
const res = getEmitResultFromProgram(program);
Expand All @@ -32,12 +28,18 @@ describe(`Extra Tests`, () => {
describe(`ts-node register script`, () => {
test(`Works with --transpileOnly`, () => {
const res = execSync("yarn g:ts-node --transpileOnly src/index.ts", { cwd: projectRoot }).toString();
expect(res).toMatch(/^null($|\r?\n)/m);
expect(res).toMatchInlineSnapshot(`
"null
"
`);
});

test(`Works with --typeCheck`, () => {
const res = execSync("yarn g:ts-node --typeCheck src/index.ts", { cwd: projectRoot }).toString();
expect(res).toMatch(/^null($|\r?\n)/);
expect(res).toMatchInlineSnapshot(`
"null
"
`);
});
});
});
Expand Down

0 comments on commit cf296bb

Please sign in to comment.