Closed nnecec closed 10 months ago
Is this the change we want? I can do more work if this is expected.
Thanks for the PR. The expectation is each test will have its own test file like ./test/cli/<test case>/index.test.ts
so the code are organized in the <test case>
folder, and we can use a test helper to create test to write less code in each file
I separated cli tests into multiple folders. If the same fixture is used, I put the test cases together in a index.test.ts
.
Request CR, thanks!
I was thinking to get a helper that automatically create a test directory for each test, and then use the fixed input filename, in each folder.
So each test you only need to call the helper, and pass the directory (maybe just __dirname
) and received the code, stderr, stdout etc. you just need to test them. Similar to what we had before
// we have a generic helper `createTest`, that can define what does the executor do
const createCliTest = createTest({
run(input, args) {
// do cli work
executeBunchee(...)
}
})
// in each test, `createCliTest` can return the result
it(...) {
const { code, stdout, distFiles, ... } = createCliTest({ directory: __dirname, args: [...] })
// test stdout etc
}
There're code conflicts
Thanks for the PR, let's tackle the improves in the separate PR, will merge this for now
resolve https://github.com/huozhi/bunchee/issues/389