-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Adding some simple constructor unit-tests as a POC * Windows version of (simplified) bash-script * Added (failing) test for ignore status. Fixed a small issue with before/after hook-scoping * Status test-script for windows * adding js & js.map files to the ignore list in order to improve debugger-support * Fixed hiding hg-ignored files - Atom checks ignore-status with absolute paths, so included absolute paths in cache - The refreshstatus promise was never resolved, so any subsequent actions where left hanging * Needed to normalize the slashes for windows * Travis test (#1) * Travis trial Trying to get travis to build only a branch * Specifying node-versions * App veyor trial (#2) Added an AppVeyor yaml file. For some reason the first test-fixture run is a lot slower than the others... So added a longer timeout as a workaround.
- Loading branch information
1 parent
6c4e0e5
commit da37ad7
Showing
14 changed files
with
182 additions
and
7 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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
node_modules/ | ||
.DS_Store | ||
test/test_repo | ||
*.js | ||
*.js.map |
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,4 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
- "4" |
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,21 @@ | ||
# Test against this version of Node.js | ||
environment: | ||
nodejs_version: "6.2.0" | ||
|
||
# Install scripts. (runs after repo cloning) | ||
install: | ||
# Get the latest stable version of Node.js or io.js | ||
- ps: Install-Product node $env:nodejs_version | ||
# install modules | ||
- npm install | ||
|
||
# Post-install test scripts. | ||
test_script: | ||
# Output useful info for debugging. | ||
- node --version | ||
- npm --version | ||
# run tests | ||
- npm test -- -t 10000 | ||
|
||
# Don't actually build. | ||
build: off |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'coffee-script/register' | ||
require './fakeWindow' | ||
HgRepository = require '../lib/hg-repository' | ||
TestRepository = require './testRepository' | ||
assert = require('chai').assert | ||
|
||
describe 'Constructing hg-repository', -> | ||
testRepo = new TestRepository 'empty_repo' | ||
|
||
before -> | ||
testRepo.init() | ||
|
||
it 'should throw exception on nonexisting repository', -> | ||
assert.throws -> | ||
repo = new HgRepository (testRepo.fullPath() + "_not_exists") | ||
, 'No Mercurial repository found searching path: ' + testRepo.fullPath() | ||
|
||
it 'should create a repo from an empty repository', -> | ||
repo = new HgRepository testRepo.fullPath() | ||
assert.ok repo | ||
|
||
after -> | ||
testRepo.destroy() |
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 @@ | ||
hg init $args[0] |
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 @@ | ||
#!/bin/bash | ||
hg init $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,4 @@ | ||
global.window = { | ||
addEventListener: ()-> | ||
removeEventListener: ()-> | ||
} |
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,34 @@ | ||
require 'coffee-script/register' | ||
require './fakeWindow' | ||
HgRepository = require '../lib/hg-repository' | ||
TestRepository = require './testRepository' | ||
assert = require('chai').assert | ||
path = require 'path' | ||
|
||
describe 'In a repo with some ignored files', -> | ||
testRepo = new TestRepository path.parse(__filename).name | ||
repo = null | ||
before -> | ||
testRepo.init() | ||
|
||
beforeEach -> | ||
repo = new HgRepository testRepo.fullPath() | ||
|
||
describe 'with an ignored file', -> | ||
ignored_file = path.join testRepo.fullPath(), 'ignored_file' | ||
|
||
it 'should return isPathIgnored true', -> | ||
repo.refreshStatus().then -> | ||
assert.equal(repo.isPathIgnored(ignored_file), true) | ||
|
||
it 'should return getPathStatus 0', -> | ||
assert.equal(repo.getPathStatus(ignored_file), 0) | ||
|
||
describe 'with a tracked file', -> | ||
clean_file = path.join testRepo.fullPath(), 'clean_file' | ||
it 'should return isPathIgnored false', -> | ||
repo.refreshStatus().then -> | ||
assert.equal(repo.isPathIgnored(clean_file), false) | ||
|
||
after -> | ||
testRepo.destroy() |
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,21 @@ | ||
hg init $args[0] | ||
set-location $args[0] | ||
|
||
("clean_file", "modified_file", "removed_file", "missing_file") | foreach-object { | ||
new-item -type File $_ | ||
hg add $_ | ||
} | ||
|
||
new-item -type File "untracked_file" | ||
new-item -type File "ignored_file" | ||
|
||
Set-Content -Path ".hgignore" -Value @" | ||
syntax:glob | ||
ignored_file | ||
"@ | ||
hg add ".hgignore" | ||
|
||
hg commit -m "Commit 1" -u "Tester <[email protected]>" | ||
Set-Content -Path "modified_file" -Value "Changes!" | ||
hg remove "removed_file" | ||
Remove-Item "missing_file" |
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,20 @@ | ||
#!/bin/bash | ||
hg init $1 | ||
cd $1 | ||
|
||
files=("clean_file" "modified_file" "removed_file" "missing_file") | ||
for f in ${files[*]} | ||
do | ||
touch $f | ||
hg add $f | ||
done | ||
touch "untracked_file" | ||
touch "ignored_file" | ||
|
||
echo -e "syntax:glob\nignored_file">".hgignore" | ||
hg add ".hgignore" | ||
|
||
hg commit -m "Commit 1" -u "Tester <[email protected]>" | ||
echo -e "Changes!">"modified_file" | ||
hg remove "removed_file" | ||
rm "missing_file" |
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,30 @@ | ||
path = require 'path' | ||
fs = require 'fs' | ||
exec = require('child_process').execSync | ||
|
||
module.exports = | ||
class TestRepository | ||
isWindows = process.platform == 'win32' | ||
extension = if isWindows then '.ps1' else '.sh' | ||
|
||
constructor: (@scenario) -> | ||
|
||
init: -> | ||
if @exists() | ||
@destroy() | ||
if isWindows | ||
exec 'powershell -file ' + path.join __dirname, @scenario + extension + ' ' + @fullPath() | ||
else | ||
exec path.join __dirname, @scenario + extension + ' ' + @fullPath() | ||
|
||
fullPath: -> | ||
path.join __dirname, 'test_repo' | ||
|
||
exists: () -> | ||
fs.existsSync(@fullPath) | ||
|
||
destroy: -> | ||
if isWindows | ||
exec 'powershell -command "remove-item -recurse -force ' + @fullPath() + '"' | ||
else | ||
exec 'rm -rf ' + @fullPath() |