Skip to content

Instantly share code, notes, and snippets.

@TsuyoshiUshio
Created July 29, 2019 18:05
Show Gist options
  • Save TsuyoshiUshio/320614fa5a7bc9f0cf7830c5b002e6d1 to your computer and use it in GitHub Desktop.
Save TsuyoshiUshio/320614fa5a7bc9f0cf7830c5b002e6d1 to your computer and use it in GitHub Desktop.
XCode task Unit Test sample
it('run Xcode with all default inputs', function (done: MochaDone) {
this.timeout(parseInt(process.env.TASK_TEST_TIMEOUT) || 20000);
let tp = path.join(__dirname, 'L0XcodeDefaults.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();
assert(tr.ran('/home/bin/xcodebuild -version'), 'xcodebuild for version should have been run.');
assert(tr.ran('/home/bin/xcodebuild -sdk $(SDK) -configuration $(Configuration) ' +
'-workspace /user/build/fun.xcodeproj/project.xcworkspace -scheme myscheme build'),
'xcodebuild for building the ios project/workspace should have been run.');
assert(tr.invokedToolCount == 2, 'should have run xcodebuild version, and xcodebuild build');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
done();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment