Files
cypress/system-tests/test/config_modules_spec.ts
Lachlan Miller 62bf87da8b fix: try to only add commonjs when running Cypress config (#27484)
* try to only add commonjs when running Cypress config

* chore: add moduleResolution node

* test: update tests to follow new patch

* move module outside of TS_NODE_COMPILER process env

* changelog

* changelog

* changelog

* changelog

* changelog

* regression test

* add tests bck in

---------

Co-authored-by: jordanpowell88 <jordan@jpdesigning.com>
2023-08-21 08:46:28 +10:00

58 lines
1.8 KiB
TypeScript

import systemTests from '../lib/system-tests'
// All projects live inside of projects/config-cjs-and-esm
describe('cypress config with esm and cjs', function () {
systemTests.setup()
;[
'config-cjs-and-esm/config-with-mjs',
'config-cjs-and-esm/config-with-cjs',
'config-cjs-and-esm/config-with-js-module',
'config-cjs-and-esm/config-with-ts-module',
'config-cjs-and-esm/config-node-next',
// This covers Vite and SvelteKit e2e projects
'config-cjs-and-esm/config-with-ts-module-and-esbuild',
'config-cjs-and-esm/config-with-ts-tsconfig-es5',
].forEach((project) => {
systemTests.it(`supports modules and cjs in ${project}`, {
project,
testingType: 'e2e',
spec: 'app.cy.js',
browser: 'chrome',
expectedExitCode: 0,
})
})
systemTests.it('supports modules and cjs in component testing', {
project: 'config-cjs-and-esm/config-with-ts-module-component',
testingType: 'component',
spec: 'src/foo.ts',
browser: 'chrome',
expectedExitCode: 0,
})
})
describe('compiles config files using the native node import', () => {
systemTests.setup()
;[
// esbuild chokes on these kinds of projects (JS Config File + TSConfig that's out of range)
// so this makes sure we're using the native node import
'config-cjs-and-esm/config-with-mjs-tsconfig-es5',
'config-cjs-and-esm/config-with-cjs-tsconfig-es5',
'config-cjs-and-esm/config-with-js-tsconfig-es5',
'config-cjs-and-esm/config-with-js-tsconfig-es3',
'config-cjs-and-esm/config-with-js-tsconfig-es2015',
'config-cjs-and-esm/config-with-module-resolution-bundler',
].forEach((project) => {
systemTests.it(`${project}`, {
project,
testingType: 'e2e',
spec: 'app.cy.js',
browser: 'chrome',
expectedExitCode: 0,
})
})
})