mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-27 06:44:57 +00:00
Make require() compliant with CommonJS 1.0
This includes potentially breaking changes.
Specifically, before this patch tiddlywiki would default to relative module identifiers
Now, tiddlywiki will only search relative paths if explicitly specified
Additionally, some "defaulted export contexts" were removed
(some modules may make assumptions about context)
Some unit tests were modified slightly from their originals
Tiddlywiki doesn't have a notion of a "main" program's path
Some require calls were explicitly made relative
None of these changes should affect the requirement under test in each case
This commit is contained in:
19
editions/testcommonjs/tiddlers/missing/program.js
Normal file
19
editions/testcommonjs/tiddlers/missing/program.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/*\
|
||||
title: missing/program.js
|
||||
type: application/javascript
|
||||
module-type: library
|
||||
|
||||
Missing test
|
||||
|
||||
\*/
|
||||
|
||||
|
||||
var test = require('test');
|
||||
try {
|
||||
require('bogus');
|
||||
test.print('FAIL require throws error when module missing', 'fail');
|
||||
} catch (exception) {
|
||||
test.print('PASS require throws error when module missing', 'pass');
|
||||
}
|
||||
test.print('DONE', 'info');
|
||||
|
||||
Reference in New Issue
Block a user