Skip to content

Commit

Permalink
test: reactivate second test
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielku15 committed Jan 19, 2025
1 parent cd20b02 commit 7c4caf4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 46 deletions.
88 changes: 44 additions & 44 deletions src/test/integration/config-file-change.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,50 @@ import {
describe('config-file-change', () => {
const workspaceFolder = integrationTestPrepare('config-file-change');

// it('rename-flow', async () => {
// let c: Controller | undefined = await getController();

// // initial state
// await c.scanFiles();
// expectTestTree(c, [
// ['folder', [['nested.test.js', [['is nested']]]]],
// ['hello.test.js', [['math', [['addition'], ['subtraction']]]]],
// ]);

// // rename mocha file
// await fs.rename(
// path.join(workspaceFolder, '.mocharc.js'),
// path.join(workspaceFolder, '.__mocharc.js'),
// );
// await onceDisposed(c);

// // controller should be gone
// expect(await tryGetController(false)).to.be.undefined;

// // rename back
// await fs.rename(
// path.join(workspaceFolder, '.__mocharc.js'),
// path.join(workspaceFolder, '.mocharc.js'),
// );

// // wait for controller
// for (let retry = 0; retry < 5; retry++) {
// c = await tryGetController(false);
// if (!c) {
// await setTimeout(1000);
// } else {
// break;
// }
// }

// // scan and test results
// expect(c).to.not.be.undefined;
// await c!.scanFiles();
// expectTestTree(c!, [
// ['folder', [['nested.test.js', [['is nested']]]]],
// ['hello.test.js', [['math', [['addition'], ['subtraction']]]]],
// ]);
// });
it('rename-flow', async () => {
let c: Controller | undefined = await getController();

// initial state
await c.scanFiles();
expectTestTree(c, [
['folder', [['nested.test.js', [['is nested']]]]],
['hello.test.js', [['math', [['addition'], ['subtraction']]]]],
]);

// rename mocha file
await fs.rename(
path.join(workspaceFolder, '.mocharc.js'),
path.join(workspaceFolder, '.__mocharc.js'),
);
await onceDisposed(c);

// controller should be gone
expect(await tryGetController(false)).to.be.undefined;

// rename back
await fs.rename(
path.join(workspaceFolder, '.__mocharc.js'),
path.join(workspaceFolder, '.mocharc.js'),
);

// wait for controller
for (let retry = 0; retry < 5; retry++) {
c = await tryGetController(false);
if (!c) {
await setTimeout(1000);
} else {
break;
}
}

// scan and test results
expect(c).to.not.be.undefined;
await c!.scanFiles();
expectTestTree(c!, [
['folder', [['nested.test.js', [['is nested']]]]],
['hello.test.js', [['math', [['addition'], ['subtraction']]]]],
]);
});

it('delete-create-flow', async () => {
let c: Controller | undefined = await getController();
Expand Down
4 changes: 2 additions & 2 deletions src/test/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export function integrationTestPrepare(name: string) {
afterEach(async () => {
await restoreWorkspace(workspaceFolder, workspaceBackup);
try {
const c = getController(false);
(await c).scanFiles();
const c = await getController(false);
await c.scanFiles();
} catch (e) {
// ignore
}
Expand Down

0 comments on commit 7c4caf4

Please sign in to comment.