-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from zambezi/interactive-exec
Execute arbitrary command on successful interactive build
- Loading branch information
Showing
15 changed files
with
156 additions
and
33 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
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
3 changes: 3 additions & 0 deletions
3
.../expected/interactive--_ez-build_--interactive__should_build_files_when_they_are_added--1
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,3 @@ | ||
Watching source files for changes... | ||
js – src/a.js -> lib/a.js,lib/a.js.map | ||
js – src/added.js -> lib/added.js,lib/added.js.map |
2 changes: 2 additions & 0 deletions
2
...cted/interactive--_ez-build_--interactive__should_rebuild_files_when_they_are_modified--1
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 @@ | ||
Watching source files for changes... | ||
js – src/a.js -> lib/a.js,lib/a.js.map |
1 change: 1 addition & 0 deletions
1
test/cli/expected/interactive--_ez-build_--interactive__should_wait_for_changes--1
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 @@ | ||
Watching source files for changes... |
5 changes: 5 additions & 0 deletions
5
...-exec--_ez-build_--interactive__echo_success____should_build_files_when_they_are_added--1
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,5 @@ | ||
Watching source files for changes... | ||
js – src/a.js -> lib/a.js,lib/a.js.map | ||
success! | ||
js – src/added.js -> lib/added.js,lib/added.js.map | ||
success! |
13 changes: 13 additions & 0 deletions
13
...-build_--interactive__echo_success____should_only_execute_command_on_successful_builds--1
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,13 @@ | ||
Watching source files for changes... | ||
js – src/a.js -> lib/a.js,lib/a.js.map | ||
success! | ||
js – src/added.js -> lib/added.js,lib/added.js.map | ||
success! | ||
js – src/added.js -> lib/added.js,lib/added.js.map | ||
success! | ||
[31mjs – src/b.js: Unexpected token, expected ; (8:18) | ||
6 | } | ||
7 | | ||
> 8 | export default 'b'export all from foo | ||
| ^ | ||
9 | [39m |
3 changes: 3 additions & 0 deletions
3
...--_ez-build_--interactive__echo_success____should_rebuild_files_when_they_are_modified--1
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,3 @@ | ||
Watching source files for changes... | ||
js – src/a.js -> lib/a.js,lib/a.js.map | ||
success! |
1 change: 1 addition & 0 deletions
1
...ted/interactive-exec--_ez-build_--interactive__echo_success____should_wait_for_changes--1
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 @@ | ||
Watching source files for 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bats | ||
load test-util | ||
|
||
setup() { | ||
load_fixture typical-project | ||
|
||
if [[ "${BATS_TEST_NUMBER}" -eq 1 ]]; then | ||
{ | ||
kill $(cat ez-build.pid) && wait $(cat ez-build.pid) | ||
} 2>/dev/null | ||
|
||
${EZ_BUILD_BIN} --interactive "echo success!" > build.log 2>&1 & | ||
EZPID=$! | ||
disown ${EZPID} | ||
echo ${EZPID} > ez-build.pid | ||
fi | ||
} | ||
|
||
teardown() { | ||
if [[ "$BATS_TEST_NUMBER" -eq "${#BATS_TEST_NAMES[@]}" ]]; then | ||
{ | ||
kill $(cat ez-build.pid) && wait $(cat ez-build.pid) | ||
} 2>/dev/null | ||
rm *.{pid,log} | ||
fi | ||
|
||
git checkout . | ||
unload_fixture typical-project | ||
} | ||
|
||
@test "'ez-build --interactive \"echo success!\"' should wait for changes" { | ||
eventually 'assert_expected "$(cat build.log)"' | ||
} | ||
|
||
@test "'ez-build --interactive \"echo success!\"' should rebuild files when they are modified" { | ||
touch src/a.js | ||
eventually 'assert_expected "$(cat build.log)"' | ||
} | ||
|
||
@test "'ez-build --interactive \"echo success!\"' should build files when they are added" { | ||
refute_exists src/added.js | ||
touch src/added.js | ||
eventually 'assert_exists lib/added.js' | ||
eventually 'assert_exists lib/added.js.map' | ||
eventually 'assert_expected "$(cat build.log)"' | ||
} | ||
|
||
@test "'ez-build --interactive \"echo success!\"' should only execute command on successful builds" { | ||
echo "export all from foo" >> src/b.js | ||
eventually 'assert_expected "$(cat build.log)"' | ||
} |
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
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