-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resolve cli init peer dependency issues (#8977)
* fix: resolve cli init peer dependency issues Closes: #8975 * fix: bump timeout for a test that takes particularly long on Node 13
- Loading branch information
1 parent
723f1e5
commit f7578d4
Showing
2 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { expect } from "chai" | ||
import { exec } from "child_process" | ||
import { dirname } from "path" | ||
import rimraf from "rimraf" | ||
|
||
describe.only("cli init command", () => { | ||
const cliPath = `${dirname(dirname(dirname(__dirname)))}/src/cli.js` | ||
const databaseOptions = [ | ||
"mysql", | ||
"mariadb", | ||
"postgres", | ||
"cockroachdb", | ||
"sqlite", | ||
"better-sqlite3", | ||
"oracle", | ||
"mssql", | ||
"mongodb", | ||
] | ||
const testProjectName = Date.now() + "TestProject" | ||
const builtSrcDirectory = "build/compiled/src" | ||
|
||
before(async () => { | ||
const chmodPromise = new Promise<void>((resolve) => { | ||
exec(`chmod 755 ${cliPath}`, (error, stdout, stderr) => { | ||
expect(error).to.not.exist | ||
expect(stderr).to.be.empty | ||
|
||
resolve() | ||
}) | ||
}) | ||
|
||
const copyPromise = new Promise<void>((resolve) => { | ||
exec( | ||
`cp package.json ${builtSrcDirectory}`, | ||
(error, stdout, stderr) => { | ||
expect(error).to.not.exist | ||
expect(stderr).to.be.empty | ||
|
||
resolve() | ||
}, | ||
) | ||
}) | ||
|
||
await Promise.all([chmodPromise, copyPromise]) | ||
}) | ||
|
||
after((done) => { | ||
rimraf(`./${builtSrcDirectory}/package.json`, (error) => { | ||
expect(error).to.not.exist | ||
|
||
done() | ||
}) | ||
}) | ||
|
||
afterEach((done) => { | ||
rimraf(`./${testProjectName}`, (error) => { | ||
expect(error).to.not.exist | ||
|
||
done() | ||
}) | ||
}) | ||
|
||
for (const databaseOption of databaseOptions) { | ||
it(`should work with ${databaseOption} option`, (done) => { | ||
exec( | ||
`${cliPath} init --name ${testProjectName} --database ${databaseOption}`, | ||
(error, stdout, stderr) => { | ||
expect(error).to.not.exist | ||
expect(stderr).to.be.empty | ||
|
||
done() | ||
}, | ||
) | ||
}).timeout(90000) | ||
} | ||
}) |