Skip to content

Commit

Permalink
Merge pull request #65 from storybookjs/fix/wrong-import
Browse files Browse the repository at this point in the history
fix: use correct import in generated test
  • Loading branch information
yannbf authored Feb 23, 2022
2 parents 75acd03 + 73bc8bf commit 06abd40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/playwright/transformPlaywright.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Playwright', () => {
const {
setupPage
} = require('../../dist/cjs');
} = require('@storybook/test-runner');
if (!require.main) {
describe("foo/bar", () => {
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('Playwright', () => {
const {
setupPage
} = require('../../dist/cjs');
} = require('@storybook/test-runner');
if (!require.main) {
describe("foo/bar", () => {
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('Playwright', () => {
const {
setupPage
} = require('../../dist/cjs');
} = require('@storybook/test-runner');
if (!require.main) {
describe("Example/Header", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/playwright/transformPlaywright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { transformCsf } from '../csf/transformCsf';

const filePrefixer = template(`
import global from 'global';
const { setupPage } = require('../../dist/cjs');
const { setupPage } = require('@storybook/test-runner');
`);

export const testPrefixer = template(
Expand Down
4 changes: 4 additions & 0 deletions test-runner-jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ module.exports = {
globalTeardown: './playwright/global-teardown.js',
testEnvironment: './playwright/custom-environment.js',
setupFilesAfterEnv: ['./playwright/jest-setup.js'],
// use local build when the package is referred
moduleNameMapper: {
'@storybook/test-runner': '<rootDir>/dist/cjs/index.js'
},
};

0 comments on commit 06abd40

Please sign in to comment.