-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
website: add support for JS/TS unit testing
Change-Id: I8bb35b7183c07c44c5e5da8dc2f2c15cc38ea64b Reviewed-on: https://go-review.googlesource.com/c/website/+/377734 Run-TryBot: Jamal Carvalho <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Alex Rakoczy <[email protected]> Trust: Jamal Carvalho <[email protected]>
- Loading branch information
Showing
8 changed files
with
7,007 additions
and
1,076 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @license | ||
* Copyright 2022 The Go Authors. All rights reserved. | ||
* Use of this source code is governed by a BSD-style | ||
* license that can be found in the LICENSE file. | ||
*/ | ||
|
||
const {transform} = require('esbuild'); | ||
|
||
exports.createTransformer = () => ({ | ||
canInstrument: true, | ||
processAsync: async (source) => { | ||
const result = await transform(source, { | ||
loader: 'ts', | ||
}); | ||
if (result.warnings.length) { | ||
result.warnings.forEach(m => { | ||
console.warn(m); | ||
}); | ||
} | ||
return { | ||
code: result.code, | ||
map: result.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
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
Oops, something went wrong.