-
Notifications
You must be signed in to change notification settings - Fork 29
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
Distribute integration test to single test files #455
Distribute integration test to single test files #455
Conversation
…ntegration-test-to-single-test
We could ship part of them and migrate the rest in the follow PRs! Just for reduce the pressure of reviewing 🤣 |
test/testing-utils.ts
Outdated
// Additional files to remove inside the fixtures directory | ||
// e.g. tsconfig.json | ||
if (filesToRemove) { | ||
for (const file of filesToRemove) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added filesToRemove
to createTest
to remove additional files created during tests (e.g. tsconfig.json)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that possible to do it in beforeEach or beforeAll in the actual test? That's also why I want to refactor the tests to have less options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Will remove it thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't mind, could you tell me why you're not using temporary dirs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to do e2e at the begining, and linked bunchee there, so it can be seaprate from the installed packages in current project. but it's a long term refactor work
Co-authored-by: Jiachi Liu <[email protected]>
…nually Co-authored-by: Jiachi Liu <[email protected]>
@@ -21,6 +20,8 @@ describe('integration', () => { | |||
'#!/usr/bin/env node', | |||
) | |||
} | |||
|
|||
await deleteFile(`${__dirname}/fixtures/tsconfig.json`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda forgot the reason why we need to remove them here?
I though if we have 2 integration tests share the same directory, any required to delete files can be remove in the beforeEach/afterEach jest lifecycle.
But not sure if we still need them here for single test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, for a single test, absolutely not.
Co-authored-by: Jiachi Liu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
import { readFile } from 'fs/promises' | ||
import { createIntegrationTest, deleteFile, existsFile } from '../../utils' | ||
|
||
afterEach(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably don't need it here, for single test
await deleteFile(`${__dirname}/fixtures/tsconfig.json`) | ||
}) | ||
|
||
describe('integration', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to use different names, like "integration - cts" for describe()
name, then give it("should ..") to describe the expectation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! Do you want me to resolve it on this PR or other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ye not blocking, can follow up later!
This PR initiated a migration of single-file integration tests to each have their own test files.
executeBunchee
fromcli/utils
totesting-utils
filesToRemove
param to be received oncreateTest
to remove files after the tests liketsconfig.json
.The migration range of this PR covers:
Resolves #449