This repository has been archived by the owner on Sep 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e0040d
commit d7030ba
Showing
64 changed files
with
868 additions
and
923 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ coverage | |
lib | ||
|
||
# tests results | ||
**/__tests__/_output* | ||
**/__tests__/output* | ||
|
||
# docs | ||
docs/**/*.mov | ||
|
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,2 @@ | ||
approvals = 1 | ||
pattern = "(?i):shipit:|:\\+1:|LGTM" |
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 was deleted.
Oops, something went wrong.
File renamed without changes.
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,87 @@ | ||
import { join } from "path" | ||
|
||
import { exec } from "child_process" | ||
|
||
const target = join(__dirname, "..", "test-phenomic-theme-base") | ||
const execOpts = { cwd: target } | ||
|
||
const phenomic = "node ./node_modules/.bin/phenomic" | ||
const timing = process.env.CI ? 10000 : 5000 | ||
|
||
describe("Integration: CLI", () => { | ||
beforeEach(() => { | ||
process.env.BABEL_ENV = "development" | ||
}) | ||
|
||
it("should throw if a CLI flag is NOT recognized", () => { | ||
return new Promise((resolve, reject) => { | ||
const child = exec( | ||
`${ phenomic } start --open=false --lol`, execOpts, | ||
(err) => { | ||
if (err && !err.killed) { | ||
clearTimeout(timeout) | ||
expect(err.message.indexOf("Unknown argument") > -1).toBeTruthy() | ||
resolve() | ||
} | ||
} | ||
) | ||
|
||
const timeout = setTimeout(() => { | ||
child.kill() | ||
reject("Test didn't finish before timeout") | ||
}, timing) | ||
}) | ||
}) | ||
|
||
it("should NOT throw if a CLI flag is recognized", () => { | ||
return new Promise((resolve, reject) => { | ||
const child = exec( | ||
`${ phenomic } start --open=false --devPort=4000`, execOpts, | ||
|
||
// should die quickly... | ||
(err) => { | ||
if (err && !err.killed) { | ||
clearTimeout(timeout) | ||
reject(err) | ||
} | ||
} | ||
) | ||
|
||
// ...or be ok quickly | ||
// we assume it's ok and kill the process | ||
// we don't need the actual build | ||
const timeout = setTimeout(() => { | ||
child.kill() | ||
resolve() | ||
}, timing) | ||
}) | ||
}) | ||
|
||
it("should NOT throw if port is used", () => { | ||
return new Promise((resolve, reject) => { | ||
const app = require("express")() | ||
const server = app.listen(3333, (err) => { | ||
if (err) { | ||
reject(err) | ||
} | ||
|
||
const child = exec( | ||
`${ phenomic } start --open=false --devPort=3333`, execOpts, | ||
|
||
(err) => { | ||
if (err && !err.killed) { | ||
clearTimeout(timeout) | ||
reject(err) | ||
} | ||
} | ||
) | ||
|
||
const timeout = setTimeout(() => { | ||
child.kill() | ||
server.close() | ||
resolve() | ||
}, timing * 2) | ||
}) | ||
}) | ||
}) | ||
}) |
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,2 @@ | ||
// eslint-disable-next-line | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000 // 30s |
Oops, something went wrong.