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

fix: ignore test file in prepare #400

Merged
merged 7 commits into from
Jan 14, 2024
Merged

fix: ignore test file in prepare #400

merged 7 commits into from
Jan 14, 2024

Conversation

hyoban
Copy link
Contributor

@hyoban hyoban commented Jan 13, 2024

Fixes #398

@@ -0,0 +1 @@
export const foo = 'foo'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can delete foo.ts and bin/ as they're not relative for the tests

it("bar", () => {
expect(true).toBe(true);
});
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also run prettier format? I think the column can be erased, also will this file run in tests suite?

@@ -0,0 +1,5 @@
describe("foo", () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, will this run? maybe change this to a spec file to cover .spec. case

src/utils.ts Outdated

export const isTestFile = (filename: string): boolean =>
// include .test. or .spec. in filename
/\.(test|spec)\./.test(filename)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to test baseNameWithoutExtension, cause it can be a.f.foo.spec.some.js which looks like a random valid case.

/\.(test|spec)$/.test(baseNameWithoutExtension(filename))

@hyoban
Copy link
Contributor Author

hyoban commented Jan 14, 2024

All updated. Thanks for your review.

@hyoban hyoban requested a review from huozhi January 14, 2024 01:36
package.json Outdated
},
"testPathIgnorePatterns": [
"/node_modules/",
"<rootDir>/test/integration/prepare-ts-with-test-file/"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let’s ignore the tests from src/ folders under test/integration

@hyoban hyoban requested a review from huozhi January 14, 2024 09:06
package.json Outdated Show resolved Hide resolved
Copy link
Owner

@huozhi huozhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@huozhi huozhi merged commit b2d1676 into huozhi:main Jan 14, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

Should bunchee --prepare ignore test file?
2 participants