Skip to content

Commit 0a7e8bf

Browse files
committed
fix: run each test in fresh environment
1 parent 6f0db32 commit 0a7e8bf

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

__e2e__/config.test.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function createCorruptedSetupEnvScript() {
3535
};
3636
}
3737

38-
beforeAll(() => {
38+
beforeEach(() => {
3939
// Clean up folder and re-create a new project
4040
cleanup(DIR);
4141
writeFiles(DIR, {});
@@ -122,6 +122,20 @@ module.exports = {
122122
};
123123
`;
124124

125+
const USER_CONFIG_TS = `
126+
export default {
127+
commands: [
128+
{
129+
name: 'test-command-ts',
130+
description: 'test command',
131+
func: () => {
132+
console.log('test-command-ts');
133+
},
134+
},
135+
],
136+
};
137+
`;
138+
125139
const USER_CONFIG_ESM = `
126140
export default {
127141
commands: [
@@ -147,11 +161,11 @@ test('should read user config from react-native.config.js', () => {
147161

148162
test('should read user config from react-native.config.ts', () => {
149163
writeFiles(path.join(DIR, 'TestProject'), {
150-
'react-native.config.ts': USER_CONFIG,
164+
'react-native.config.ts': USER_CONFIG_TS,
151165
});
152166

153-
const {stdout} = runCLI(path.join(DIR, 'TestProject'), ['test-command']);
154-
expect(stdout).toBe('test-command');
167+
const {stdout} = runCLI(path.join(DIR, 'TestProject'), ['test-command-ts']);
168+
expect(stdout).toBe('test-command-ts');
155169
});
156170

157171
test('should read user config from react-native.config.mjs', () => {

0 commit comments

Comments
 (0)