Skip to content

Commit

Permalink
fix: override ts-node module behaviour [gh-768]
Browse files Browse the repository at this point in the history
  • Loading branch information
clample committed Jul 27, 2023
1 parent fcf0113 commit 7a3174d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { defineConfig } from 'checkly'

const config = defineConfig({
projectName: 'Boilerplate Project',
logicalId: 'boilerplate-project',
projectName: 'Test ECMAScript Module Project',
logicalId: 'test-esm-project',
repoUrl: 'https://github.com/checkly/checkly-cli',
checks: {
checkMatch: '**/__checks__/**/*.check.ts',
checkMatch: '**/*.check.ts',
},
cli: {
runLocation: 'eu-west-1',
},
})

export default config
export default config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { BrowserCheck } from 'checkly/constructs'

const browserCheck = new BrowserCheck('secret-browser-check', {

Check warning on line 3 in packages/cli/e2e/__tests__/fixtures/esm-module/checks.check.ts

View workflow job for this annotation

GitHub Actions / lint

'browserCheck' is assigned a value but never used
name: 'Show SECRET_ENV value',
activated: false,
code: {
content: 'console.info(process.env.SECRET_ENV);',
},
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "boilerlate-project",
"name": "Test ECMAScript Module Project",
"version": "1.0.0",
"description": "",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/e2e/__tests__/test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('test', () => {
expect(result.stdout).toContain('Reached timeout of 0 seconds waiting for check result.')
})

it.only('ESModule project should run successfully', () => {
it('ESModule project should run successfully', () => {
const secretEnv = uuid.v4()
const result = runChecklyCli({
args: ['test', '-e', `SECRET_ENV=${secretEnv}`, '--verbose'],
Expand All @@ -152,7 +152,6 @@ describe('test', () => {
directory: path.join(__dirname, 'fixtures', 'esm-module'),
timeout: 120000, // 2 minutes
})
console.log('GOT ', result)
expect(result.stdout).not.toContain('File extension type example')
expect(result.stdout).toContain(secretEnv)
expect(result.status).toBe(0)
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/services/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ async function getTsCompiler (): Promise<Service> {
try {
const tsNode = await import('ts-node')
tsCompiler = tsNode.register({
moduleTypes: {
'**/*': 'cjs',
},
compilerOptions: {
module: 'CommonJS',
},
Expand Down

0 comments on commit 7a3174d

Please sign in to comment.