This repository was archived by the owner on Sep 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
Windows fixes #158
Closed
Closed
Windows fixes #158
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5406923
Windows tsc_wrapped path fixes
gregmagolan 5b3b510
Windows fixes for examples tests
gregmagolan aaa5eae
ts_web_test & karma fixes for Windows
gregmagolan 2e09a94
Add a comment re: CHROME_BIN usage in karma.conf.js
gregmagolan 66f3a35
Simplify karma config
gregmagolan dcb1a81
Cleanup for path fixes
gregmagolan eaf8483
Fix comments in internal/tsc_wrapped/path.ts
gregmagolan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,40 +1,69 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
MANIFEST="$TEST_SRCDIR/MANIFEST" | ||
if [ -e "$MANIFEST" ]; then | ||
while read line; do | ||
declare -a PARTS=($line) | ||
if [ "${PARTS[0]}" == "build_bazel_rules_typescript/examples/some_library/library.js" ]; then | ||
readonly LIBRARY_JS=$(cat ${PARTS[1]}) | ||
elif [ "${PARTS[0]}" == "build_bazel_rules_typescript/examples/bar.js" ]; then | ||
readonly BAR_JS=$(cat ${PARTS[1]}) | ||
elif [ "${PARTS[0]}" == "build_bazel_rules_typescript/examples/foo.js" ]; then | ||
readonly FOO_JS=$(cat ${PARTS[1]}) | ||
fi | ||
done < $MANIFEST | ||
else | ||
readonly LIBRARY_JS=$(cat $TEST_SRCDIR/build_bazel_rules_typescript/examples/some_library/library.js) | ||
readonly BAR_JS=$(cat $TEST_SRCDIR/build_bazel_rules_typescript/examples/bar.js) | ||
readonly FOO_JS=$(cat $TEST_SRCDIR/build_bazel_rules_typescript/examples/foo.js) | ||
fi | ||
|
||
# should produce named UMD modules | ||
readonly LIBRARY_JS=$(cat $TEST_SRCDIR/build_bazel_rules_typescript/examples/some_library/library.js) | ||
if [[ "$LIBRARY_JS" != *"define(\"build_bazel_rules_typescript/examples/some_library/library\""* ]]; then | ||
echo "Expected library.js to declare named module, but was" | ||
echo "$A_JS" | ||
echo "$LIBRARY_JS" | ||
exit 1 | ||
fi | ||
|
||
# should produce named UMD modules | ||
if [[ "$BAR_JS" != *"define(\"build_bazel_rules_typescript/examples/bar\""* ]]; then | ||
echo "Expected bar.js to declare named module, but was" | ||
echo "$BAR_JS" | ||
exit 1 | ||
fi | ||
|
||
# should give a name to required modules | ||
readonly BAR_JS=$(cat $TEST_SRCDIR/build_bazel_rules_typescript/examples/bar.js) | ||
if [[ "$BAR_JS" != *"require(\"build_bazel_rules_typescript/examples/foo\")"* ]]; then | ||
echo "Expected bar.js to require named module foo, but was" | ||
echo "$BAR_JS" | ||
exit 1 | ||
fi | ||
|
||
# should give a name to required modules from other compilation unit | ||
readonly FOO_JS=$(cat $TEST_SRCDIR/build_bazel_rules_typescript/examples/bar.js) | ||
if [[ "$FOO_JS" != *"require(\"build_bazel_rules_typescript/examples/some_library/library\")"* ]]; then | ||
if [[ "$BAR_JS" != *"require(\"build_bazel_rules_typescript/examples/some_library/library\")"* ]]; then | ||
echo "Expected bar.js to require named module library, but was" | ||
echo "$FOO_JS" | ||
echo "$BAR_JS" | ||
exit 1 | ||
fi | ||
|
||
# should give a name to required generated modules without bazel-bin | ||
if [[ "$FOO_JS" != *"require(\"build_bazel_rules_typescript/examples/generated_ts/foo\")"* ]]; then | ||
echo "Expected foo.js to require generated named module foo, but was" | ||
echo "$FOO_JS" | ||
if [[ "$BAR_JS" != *"require(\"build_bazel_rules_typescript/examples/generated_ts/foo\")"* ]]; then | ||
echo "Expected bar.js to require generated named module foo, but was" | ||
echo "$BAR_JS" | ||
exit 1 | ||
fi | ||
|
||
# should not give a module name to external modules | ||
if [[ "$FOO_JS" != *"require(\"typescript\")"* ]]; then | ||
echo "Expected foo.js to require typescript by its original name, but was" | ||
if [[ "$BAR_JS" != *"require(\"typescript\")"* ]]; then | ||
echo "Expected bar.js to require typescript by its original name, but was" | ||
echo "$BAR_JS" | ||
exit 1 | ||
fi | ||
|
||
# should produce named UMD modules | ||
if [[ "$FOO_JS" != *"define(\"build_bazel_rules_typescript/examples/foo\""* ]]; then | ||
echo "Expected foo.js to declare named module, but was" | ||
echo "$FOO_JS" | ||
exit 1 | ||
fi |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,5 +1,60 @@ | ||
// Karma configuration | ||
// GENERATED BY Bazel | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const tmp = require('tmp'); | ||
|
||
// When karma is configured to use Chrome it will look for a CHROME_BIN | ||
// environment variable. This line points Karma to use puppeteer. | ||
// See https://github.com/karma-runner/karma-chrome-launcher/blob/master/README.md#headless-chromium-with-puppeteer | ||
process.env.CHROME_BIN = require('puppeteer').executablePath(); | ||
|
||
let files = [ | ||
TMPL_files | ||
]; | ||
|
||
const manifestFile = path.join(process.env.TEST_SRCDIR, "MANIFEST"); | ||
if (fs.existsSync(manifestFile)) { | ||
const manifest = {}; | ||
fs.readFileSync(manifestFile, { encoding: 'utf8' }) | ||
.split('\n') | ||
.forEach((l) => { | ||
const m = l.split(' '); | ||
manifest[m[0]] = m[1]; | ||
}); | ||
const manifestKeys = Object.keys(manifest); | ||
files = files.map((f) => { | ||
if (manifestKeys.includes(f)) { | ||
return manifest[f]; | ||
} else { | ||
throw new Error(`File not found in MANIFEST: ${f}`); | ||
} | ||
}); | ||
} | ||
|
||
let requireFiles = [ | ||
TMPL_files | ||
]; | ||
|
||
var requireConfigContent = ` | ||
// A simplified version of Karma's requirejs.config.tpl.js for use with Karma under Bazel | ||
(function(){ | ||
var allFiles = ` + JSON.stringify(requireFiles) + `; | ||
var allTestFiles = []; | ||
allFiles.forEach(function (file) { | ||
if (/(spec|test)\\.js$/i.test(file)) { | ||
allTestFiles.push(file.replace(/\\.js$/, '')) | ||
} | ||
}); | ||
require(allTestFiles, window.__karma__.start); | ||
})(); | ||
`; | ||
|
||
const requireConfigFile = tmp.fileSync({keep: false, postfix: '.js', dir: process.env['TEST_TMPDIR']}); | ||
console.log('Writing require config file to ', requireConfigFile.name); | ||
fs.writeFileSync(requireConfigFile.name, requireConfigContent); | ||
files.push(requireConfigFile.name); | ||
|
||
module.exports = function(config) { | ||
if (process.env['IBAZEL_NOTIFY_CHANGES'] === 'y') { | ||
// Tell karma to only listen for ibazel messages on stdin rather than watch all the input files | ||
|
@@ -49,8 +104,8 @@ module.exports = function(config) { | |
|
||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: 'TMPL_runfiles_path', | ||
files: [ | ||
TMPL_files | ||
] | ||
|
||
// files | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stray comment? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah. a bit redundant. there was a comment before every other property and I didn't know what else to put. |
||
files: files, | ||
}) | ||
} |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think you need this anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean switch to git_repository from the skylark rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind, this is just a fast-forward of master