Skip to content

Commit fe81472

Browse files
committed
fixes
1 parent 8ec6db1 commit fe81472

File tree

2 files changed

+33
-44
lines changed

2 files changed

+33
-44
lines changed

src/config/jest-playwright.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ const getJestPlaywrightConfig = (): Config.InitialOptions => {
2626
const expectPlaywrightPath = path.dirname(require.resolve('expect-playwright'));
2727
return {
2828
runner: path.join(resolvedRunnerPath, 'dist/jest-playwright-entries/runner.js'),
29-
globalSetup: path.join(resolvedRunnerPath, 'playwright/global-setup.js'),
30-
globalTeardown: path.join(resolvedRunnerPath, 'playwright/global-teardown.js'),
3129
testEnvironment: path.join(resolvedRunnerPath, 'playwright/custom-environment.js'),
3230
setupFilesAfterEnv: [
3331
path.join(resolvedRunnerPath, 'playwright/jest-setup.js'),

src/test-storybook.ts

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async function reportCoverage() {
9191
execSync(
9292
`node ${nycBinFullPath} report --reporter=text --reporter=lcov -t ${coverageFolder} --report-dir ${coverageFolder}`,
9393
{
94-
stdio: 'inherit',
94+
stdio: 'pipe',
9595
cwd: process.cwd(),
9696
}
9797
);
@@ -158,48 +158,37 @@ async function executeJestPlaywright(args: JestOptions) {
158158
' '
159159
)} --config "${jestConfigPath}" --color`;
160160

161-
const runThing = async (type: 'previous' | 'current') => {
162-
if (type === 'previous') {
163-
execSync(command, {
164-
stdio: 'inherit',
165-
cwd: process.cwd(),
166-
});
167-
} else {
168-
const child = spawn(command, {
169-
shell: true,
170-
cwd: process.cwd(),
171-
stdio: ['inherit', 'pipe'],
172-
});
173-
const shouldLog = (str: string) => {
174-
return (
175-
!str.includes('watchman') &&
176-
!str.includes('DeprecationWarning') &&
177-
!str.includes('ExperimentalWarning')
178-
);
179-
};
180-
const exitCode = await new Promise<number>((resolve) => {
181-
// filter out messages like DeprecationWarning and ExperimentalWarning
182-
child.stdout?.on('data', (data) => {
183-
const str = data.toString();
184-
if (shouldLog(str)) {
185-
process.stdout.write(data);
186-
}
187-
});
188-
child.stderr?.on('data', (data) => {
189-
const str = data.toString();
190-
if (shouldLog(str)) {
191-
process.stderr.write(data);
192-
}
193-
});
194-
195-
child.on('exit', (exitCode) => resolve(exitCode || 0));
196-
});
197-
198-
process.exit(exitCode);
199-
}
161+
const child = spawn(command, {
162+
shell: true,
163+
cwd: process.cwd(),
164+
stdio: ['inherit', 'pipe'],
165+
});
166+
const shouldLog = (str: string) => {
167+
return (
168+
!str.includes('watchman') &&
169+
!str.includes('DeprecationWarning') &&
170+
!str.includes('ExperimentalWarning')
171+
);
200172
};
173+
const exitCode = await new Promise<number>((resolve) => {
174+
// filter out messages like DeprecationWarning and ExperimentalWarning
175+
child.stdout?.on('data', (data) => {
176+
const str = data.toString();
177+
if (shouldLog(str)) {
178+
process.stdout.write(data);
179+
}
180+
});
181+
child.stderr?.on('data', (data) => {
182+
const str = data.toString();
183+
if (shouldLog(str)) {
184+
process.stderr.write(data);
185+
}
186+
});
187+
188+
child.on('exit', (exitCode) => resolve(exitCode || 0));
189+
});
201190

202-
await runThing('previous');
191+
process.exit(exitCode);
203192
}
204193

205194
async function checkStorybook(url: string) {
@@ -298,7 +287,9 @@ function ejectConfiguration() {
298287
}
299288

300289
// copy contents of origin and replace ../dist with @storybook/test-runner
301-
const content = fs.readFileSync(origin, 'utf-8').replace(/..\/dist/g, '@storybook/test-runner');
290+
const content = fs
291+
.readFileSync(origin, 'utf-8')
292+
.replace('../dist/index.js', '@storybook/test-runner');
302293
fs.writeFileSync(destination, content);
303294
log(`Configuration file successfully generated at ${destination}`);
304295
}

0 commit comments

Comments
 (0)