|
1 | 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP |
2 | 2 |
|
3 | | -exports[`doesn't resolve paths out of root dir: code 1`] = ` |
4 | | -"local ____exports = {} |
5 | | -local module = require(\\"../module\\") |
6 | | -local ____ = module |
7 | | -return ____exports" |
| 3 | +exports[`current directory index: modules 1`] = ` |
| 4 | +"[\\"index\\"] = function() |
| 5 | +
|
| 6 | +end, |
| 7 | +[\\"main\\"] = function() |
| 8 | +local ____exports = {} |
| 9 | +require(\\"index\\") |
| 10 | +return ____exports |
| 11 | +
|
| 12 | +end," |
| 13 | +`; |
| 14 | + |
| 15 | +exports[`entry point in nested directory: modules 1`] = ` |
| 16 | +"[\\"module\\"] = function() |
| 17 | +
|
| 18 | +end, |
| 19 | +[\\"main\\"] = function() |
| 20 | +local ____exports = {} |
| 21 | +require(\\"module\\") |
| 22 | +return ____exports |
| 23 | +
|
| 24 | +end," |
| 25 | +`; |
| 26 | + |
| 27 | +exports[`file in a sibling directory: modules 1`] = ` |
| 28 | +"[\\"foo.bar\\"] = function() |
| 29 | +
|
| 30 | +end, |
| 31 | +[\\"main\\"] = function() |
| 32 | +local ____exports = {} |
| 33 | +require(\\"foo.bar\\") |
| 34 | +return ____exports |
| 35 | +
|
| 36 | +end," |
| 37 | +`; |
| 38 | + |
| 39 | +exports[`not transpiled script file error: diagnostics 1`] = `"/main.ts(2,22): error TSTL: Resolved source file '/module.ts' is not a part of the project."`; |
| 40 | + |
| 41 | +exports[`not transpiled script file error: modules 1`] = ` |
| 42 | +"[\\"main\\"] = function() |
| 43 | +local ____exports = {} |
| 44 | +local ____ = require(--[[ ./module ]] error(\\"Resolved source file '/module.ts' is not a part of the project.\\")) |
| 45 | +____exports.value = ____.value |
| 46 | +return ____exports |
| 47 | +
|
| 48 | +end," |
| 49 | +`; |
| 50 | + |
| 51 | +exports[`package resolution package with dependencies: modules 1`] = ` |
| 52 | +"[\\"main\\"] = function() |
| 53 | +local ____exports = {} |
| 54 | +do |
| 55 | + local ____lib = require(\\"node_modules.lib.index\\") |
| 56 | + local value = ____lib.value |
| 57 | + ____exports.value = value |
| 58 | +end |
| 59 | +return ____exports |
| 60 | +
|
| 61 | +end, |
| 62 | +[\\"node_modules.lib.index\\"] = function() |
| 63 | +return require(\\"node_modules.lib2.index\\") |
| 64 | +end, |
| 65 | +[\\"node_modules.lib2.index\\"] = function() |
| 66 | +return { value = true } |
| 67 | +end," |
| 68 | +`; |
| 69 | + |
| 70 | +exports[`package resolution package.json with exports: modules 1`] = ` |
| 71 | +"[\\"main\\"] = function() |
| 72 | +local ____exports = {} |
| 73 | +do |
| 74 | + local ____lib = require(\\"node_modules.lib.dist.index\\") |
| 75 | + local value = ____lib.value |
| 76 | + ____exports.value = value |
| 77 | +end |
| 78 | +return ____exports |
| 79 | +
|
| 80 | +end, |
| 81 | +[\\"node_modules.lib.dist.index\\"] = function() |
| 82 | +return { value = true } |
| 83 | +end," |
| 84 | +`; |
| 85 | + |
| 86 | +exports[`package resolution package.json with versioned exports: modules 1`] = ` |
| 87 | +"[\\"main\\"] = function() |
| 88 | +local ____exports = {} |
| 89 | +do |
| 90 | + local ____lib = require(\\"node_modules.lib.dist.5__3\\") |
| 91 | + local value = ____lib.value |
| 92 | + ____exports.value = value |
| 93 | +end |
| 94 | +return ____exports |
| 95 | +
|
| 96 | +end, |
| 97 | +[\\"node_modules.lib.dist.5__3\\"] = function() |
| 98 | +return { value = \\"5.3\\" } |
| 99 | +end," |
| 100 | +`; |
| 101 | + |
| 102 | +exports[`package resolution without package.json: modules 1`] = ` |
| 103 | +"[\\"main\\"] = function() |
| 104 | +local ____exports = {} |
| 105 | +do |
| 106 | + local ____lib = require(\\"node_modules.lib.index\\") |
| 107 | + local value = ____lib.value |
| 108 | + ____exports.value = value |
| 109 | +end |
| 110 | +return ____exports |
| 111 | +
|
| 112 | +end, |
| 113 | +[\\"node_modules.lib.index\\"] = function() |
| 114 | +return { value = true } |
| 115 | +end," |
8 | 116 | `; |
9 | 117 |
|
10 | | -exports[`doesn't resolve paths out of root dir: diagnostics 1`] = `"src/main.ts(2,33): error TSTL: Cannot create require path. Module '../module' does not exist within --rootDir."`; |
| 118 | +exports[`resolution out of rootDir .ts file: diagnostics 1`] = `"src/main.ts(2,35): error TS6059: File 'module.ts' is not under 'rootDir' 'src'. 'rootDir' is expected to contain all source files."`; |
| 119 | + |
| 120 | +exports[`rootDir inference: modules 1`] = ` |
| 121 | +"[\\"module\\"] = function() |
| 122 | +
|
| 123 | +end, |
| 124 | +[\\"main\\"] = function() |
| 125 | +local ____exports = {} |
| 126 | +require(\\"module\\") |
| 127 | +return ____exports |
| 128 | +
|
| 129 | +end," |
| 130 | +`; |
| 131 | + |
| 132 | +exports[`sibling directory index: modules 1`] = ` |
| 133 | +"[\\"foo.index\\"] = function() |
| 134 | +
|
| 135 | +end, |
| 136 | +[\\"main\\"] = function() |
| 137 | +local ____exports = {} |
| 138 | +require(\\"foo.index\\") |
| 139 | +return ____exports |
| 140 | +
|
| 141 | +end," |
| 142 | +`; |
| 143 | + |
| 144 | +exports[`sibling file: modules 1`] = ` |
| 145 | +"[\\"foo\\"] = function() |
| 146 | +
|
| 147 | +end, |
| 148 | +[\\"main\\"] = function() |
| 149 | +local ____exports = {} |
| 150 | +require(\\"foo\\") |
| 151 | +return ____exports |
| 152 | +
|
| 153 | +end," |
| 154 | +`; |
0 commit comments