| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,11 +42,13 @@ async function testWatch({ | |||
| 42 | 42 | file, | |
| 43 | 43 | action = 'update', | |
| 44 | 44 | fileToCreate, | |
| 45 | + isolation, | ||
| 45 | 46 | }) { | |
| 46 | 47 | const ran1 = util.createDeferredPromise(); | |
| 47 | 48 | const ran2 = util.createDeferredPromise(); | |
| 48 | 49 | const child = spawn(process.execPath, | |
| 49 | 50 | ['--watch', '--test', '--test-reporter=spec', | |
| 51 | + isolation ? `--experimental-test-isolation=${isolation}` : '', | ||
| 50 | 52 | file ? fixturePaths[file] : undefined].filter(Boolean), | |
| 51 | 53 | { encoding: 'utf8', stdio: 'pipe', cwd: tmpdir.path }); | |
| 52 | 54 | let stdout = ''; | |
@@ -166,31 +168,39 @@ async function testWatch({ | |||
| 166 | 168 | ||
| 167 | 169 | describe('test runner watch mode', () => { | |
| 168 | 170 | beforeEach(refresh); | |
| 169 | - it('should run tests repeatedly', async () => { | ||
| 170 | - await testWatch({ file: 'test.js', fileToUpdate: 'test.js' }); | ||
| 171 | - }); | ||
| 172 | - | ||
| 173 | - it('should run tests with dependency repeatedly', async () => { | ||
| 174 | - await testWatch({ file: 'test.js', fileToUpdate: 'dependency.js' }); | ||
| 175 | - }); | ||
| 176 | - | ||
| 177 | - it('should run tests with ESM dependency', async () => { | ||
| 178 | - await testWatch({ file: 'test.js', fileToUpdate: 'dependency.mjs' }); | ||
| 179 | - }); | ||
| 180 | - | ||
| 181 | - it('should support running tests without a file', async () => { | ||
| 182 | - await testWatch({ fileToUpdate: 'test.js' }); | ||
| 183 | - }); | ||
| 184 | - | ||
| 185 | - it('should support a watched test file rename', async () => { | ||
| 186 | - await testWatch({ fileToUpdate: 'test.js', action: 'rename' }); | ||
| 187 | - }); | ||
| 188 | - | ||
| 189 | - it('should not throw when delete a watched test file', async () => { | ||
| 190 | - await testWatch({ fileToUpdate: 'test.js', action: 'delete' }); | ||
| 191 | - }); | ||
| 192 | - | ||
| 193 | - it('should run new tests when a new file is created in the watched directory', async () => { | ||
| 194 | - await testWatch({ action: 'create', fileToCreate: 'new-test-file.test.js' }); | ||
| 195 | - }); | ||
| 171 | + for (const isolation of ['none', 'process']) { | ||
| 172 | + describe(`isolation: ${isolation}`, () => { | ||
| 173 | + it('should run tests repeatedly', async () => { | ||
| 174 | + await testWatch({ file: 'test.js', fileToUpdate: 'test.js', isolation }); | ||
| 175 | + }); | ||
| 176 | + | ||
| 177 | + it('should run tests with dependency repeatedly', async () => { | ||
| 178 | + await testWatch({ file: 'test.js', fileToUpdate: 'dependency.js', isolation }); | ||
| 179 | + }); | ||
| 180 | + | ||
| 181 | + it('should run tests with ESM dependency', async () => { | ||
| 182 | + await testWatch({ file: 'test.js', fileToUpdate: 'dependency.mjs', isolation }); | ||
| 183 | + }); | ||
| 184 | + | ||
| 185 | + it('should support running tests without a file', async () => { | ||
| 186 | + await testWatch({ fileToUpdate: 'test.js', isolation }); | ||
| 187 | + }); | ||
| 188 | + | ||
| 189 | + it('should support a watched test file rename', async () => { | ||
| 190 | + await testWatch({ fileToUpdate: 'test.js', action: 'rename', isolation }); | ||
| 191 | + }); | ||
| 192 | + | ||
| 193 | + it('should not throw when delete a watched test file', async () => { | ||
| 194 | + await testWatch({ fileToUpdate: 'test.js', action: 'delete', isolation }); | ||
| 195 | + }); | ||
| 196 | + | ||
| 197 | + it('should run new tests when a new file is created in the watched directory', { | ||
| 198 | + todo: isolation === 'none' ? | ||
| 199 | + 'This test is failing when isolation is set to none and must be fixed' : | ||
| 200 | + undefined, | ||
| 201 | + }, async () => { | ||
| 202 | + await testWatch({ action: 'create', fileToCreate: 'new-test-file.test.js', isolation }); | ||
| 203 | + }); | ||
| 204 | + }); | ||
| 205 | + } | ||
| 196 | 206 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments