Skip to content

Commit

Permalink
lintfix
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed Nov 3, 2021
1 parent fad5c41 commit 2365105
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
10 changes: 7 additions & 3 deletions src/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,16 @@ test.suite('ts-node', (test) => {
{
env: {
...process.env,
NODE_OPTIONS: `${ process.env.NODE_OPTIONS || '' } --require ${ require.resolve('../../tests/spy-swc-transpiler') }`
}
NODE_OPTIONS: `${
process.env.NODE_OPTIONS || ''
} --require ${require.resolve('../../tests/spy-swc-transpiler')}`,
},
}
);
expect(err).toBe(null);
expect(stdout).toMatch('Hello World! swc transpiler invocation count: 1\n');
expect(stdout).toMatch(
'Hello World! swc transpiler invocation count: 1\n'
);
});
}

Expand Down
8 changes: 4 additions & 4 deletions tests/spy-swc-transpiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ const swcTranspiler = require('ts-node/transpilers/swc');
global.swcTranspilerCalls = 0;

const wrappedCreate = swcTranspiler.create;
swcTranspiler.create = function(...args) {
swcTranspiler.create = function (...args) {
const transpiler = wrappedCreate(...args);
const wrappedTranspile = transpiler.transpile;
transpiler.transpile = function(...args) {
transpiler.transpile = function (...args) {
global.swcTranspilerCalls++;
return wrappedTranspile.call(this, ...args);
}
};
return transpiler;
}
};
2 changes: 1 addition & 1 deletion tests/transpile-only-swc-shorthand-via-tsconfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class World {}

// intentional type errors to check transpile-only ESM loader skips type checking
parseInt(1101, 2);
const x: number = `Hello ${World.name}! swc transpiler invocation count: ${ global.swcTranspilerCalls }`;
const x: number = `Hello ${World.name}! swc transpiler invocation count: ${global.swcTranspilerCalls}`;
console.log(x);

// test module type emit
Expand Down
2 changes: 1 addition & 1 deletion tests/transpile-only-swc-via-tsconfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class World {}

// intentional type errors to check transpile-only ESM loader skips type checking
parseInt(1101, 2);
const x: number = `Hello ${World.name}! swc transpiler invocation count: ${ global.swcTranspilerCalls }`;
const x: number = `Hello ${World.name}! swc transpiler invocation count: ${global.swcTranspilerCalls}`;
console.log(x);

// test module type emit
Expand Down
2 changes: 1 addition & 1 deletion tests/transpile-only-swc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class World {}

// intentional type errors to check transpile-only ESM loader skips type checking
parseInt(1101, 2);
const x: number = `Hello ${World.name}! swc transpiler invocation count: ${ global.swcTranspilerCalls }`;
const x: number = `Hello ${World.name}! swc transpiler invocation count: ${global.swcTranspilerCalls}`;
console.log(x);

// test module type emit
Expand Down

0 comments on commit 2365105

Please sign in to comment.