Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: test.extend outside local yarn workspace doesn't seem to work #30809

Closed
basickarl opened this issue May 14, 2024 · 2 comments
Closed

[Bug]: test.extend outside local yarn workspace doesn't seem to work #30809

basickarl opened this issue May 14, 2024 · 2 comments

Comments

@basickarl
Copy link

basickarl commented May 14, 2024

An error is thrown after using text.extend in a parallel local yarn workspace.

Version

1.43.1

Steps to reproduce

Two yarn workspaces.

index.ts (this is in the yarn workspace: @testy/audit)

export function auditTest(test) {
  test.beforeEach(async () => { // <--- works
    console.info('beforeEach');
  });

  test.afterEach(async () => { // <--- works
    console.info('afterEach');
  });

  const newTest = test.extend({ // <--- issue
    customValueThree: 'Hello',
  });

  return newTest;
}

testy.ts (this is in the yarn workspace: @testy/react)

export function testy(test) {
  const newTest = test.extend({ // <--- works
    customValueOne: 'Hello',
  });
  return newTest;
}

test.playwright.tsx (this is in the yarn workspace: @testy/react)

import { auditTest } from '@testy/audit'; // <--- issue
import { testy } from './testy';

const testOne = testy(defaultTest); // <--- works

const testTwo = testOne.extend({ // <--- works
  customValueTwo: 'Hello2',
});

const test = auditTest(testTwo); // <--- issue

test.only('testy', async ({
  page,
  mount,
  customValueOne, // <--- works
  customValueTwo, // <--- works
  customValueThree, // <-- does not work
}) => {
  console.info(customValueOne, customValueTwo, customValueThree);
});

Expected behavior

Expected the test to show the console log output with no errors.

Actual behavior

> playwright test -c playwright-component-testing.config.ts testy 1

Test has unknown parameter "customValueThree".

   at testy/testy.playwright.tsx:39

  37 | const test = auditTest(testTwo);
  38 |
> 39 | test.only('testy', async ({
     |      ^
  40 |   page,
  41 |   mount,
  42 |   customValueOne,


To open last HTML report run:

  npx playwright show-report

npm ERR! Lifecycle script `test:playwright` failed with error: 
npm ERR! Error: command failed 

Additional context

We are using @playwright/experimental-ct-react@1.43.1

Environment

npx envinfo --preset playwright

  System:
    OS: macOS 14.1.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 17.98 GB / 64.00 GB
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 4.0.2 - ~/.nvm/versions/node/v20.9.0/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
  Languages:
    Bash: 3.2.57 - /bin/bash
@basickarl basickarl changed the title [Bug]: test.extend outside local package doesn't seem to work [Bug]: test.extend outside local yarn workspace doesn't seem to work May 14, 2024
@yury-s
Copy link
Member

yury-s commented May 15, 2024

Please provide a reproduction that we can run locally. Please follow the bug template and provide a clonable repository.

@yury-s
Copy link
Member

yury-s commented May 20, 2024

We need more information to act on this report. Please file a new one and link to this issue when you get back to it!

@yury-s yury-s closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants