test(ngcc): reformat some subject code for tests (#36989)

Using backtick multiline strings leads to confusing layout
that does not fit with the surrounding indentation. Also it
can lead to test fragility due to automated code formatting.

This commit changes just one set of subject code to use
a more resilient string concatenation approach.

PR Close #36989
This commit is contained in:
Pete Bacon Darwin 2020-05-12 08:20:01 +01:00 committed by Kara Erickson
parent 8b79075497
commit 9846b19986
2 changed files with 116 additions and 133 deletions

View File

@ -513,71 +513,62 @@ var c = file_a.a;
EXPORTS_FILES = [
{
name: _('/index.js'),
contents: `
var a_module = require('./a_module');
var b_module = require('./b_module');
var xtra_module = require('./xtra_module');
var wildcard_reexports_emitted_helpers = require('./wildcard_reexports_emitted_helpers');
var wildcard_reexports_imported_helpers = require('./wildcard_reexports_imported_helpers');
`
contents: `var a_module = require('./a_module');\n` +
`var b_module = require('./b_module');\n` +
`var xtra_module = require('./xtra_module');\n` +
`var wildcard_reexports_emitted_helpers = require('./wildcard_reexports_emitted_helpers');\n` +
`var wildcard_reexports_imported_helpers = require('./wildcard_reexports_imported_helpers');\n`,
},
{
name: _('/a_module.js'),
contents: `
var a = 'a';
exports.a = a;
`,
contents: `// In TS 3.9 exports are initialized to undefined at the top of the file\n` +
`exports.a = void 0;\n` +
`var a = 'a';\n` +
`exports.a = a;\n`,
},
{
name: _('/b_module.js'),
contents: `
var core = require('@angular/core');
var a_module = require('./a_module');
var b = a_module.a;
var e = 'e';
var SomeClass = (function() {
function SomeClass() {}
return SomeClass;
}());
exports.Directive = core.Directive;
exports.a = a_module.a;
exports.b = b;
exports.c = a_module.a;
exports.d = b;
exports.e = e;
exports.DirectiveX = core.Directive;
exports.SomeClass = SomeClass;
`,
contents: `var core = require('@angular/core');\n` +
`var a_module = require('./a_module');\n` +
`var b = a_module.a;\n` +
`var e = 'e';\n` +
`var SomeClass = (function() {\n` +
` function SomeClass() {}\n` +
` return SomeClass;\n` +
`}());\n` +
`\n` +
`exports.Directive = core.Directive;\n` +
`exports.a = a_module.a;\n` +
`exports.b = b;\n` +
`exports.c = a_module.a;\n` +
`exports.d = b;\n` +
`exports.e = e;\n` +
`exports.DirectiveX = core.Directive;\n` +
`exports.SomeClass = SomeClass;\n`,
},
{
name: _('/xtra_module.js'),
contents: `
var xtra1 = 'xtra1';
var xtra2 = 'xtra2';
exports.xtra1 = xtra1;
exports.xtra2 = xtra2;
`,
contents: `var xtra1 = 'xtra1';\n` +
`var xtra2 = 'xtra2';\n` +
`exports.xtra1 = xtra1;\n` +
`exports.xtra2 = xtra2;\n`,
},
{
name: _('/wildcard_reexports_emitted_helpers.js'),
contents: `
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var b_module = require("./b_module");
__export(b_module);
__export(require("./xtra_module"));
`,
contents: `function __export(m) {\n` +
` for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n` +
`}\n` +
`var b_module = require("./b_module");\n` +
`__export(b_module);\n` +
`__export(require("./xtra_module"));\n`,
},
{
name: _('/wildcard_reexports_imported_helpers.js'),
contents: `
var tslib_1 = require("tslib");
var b_module = require("./b_module");
tslib_1.__exportStar(b_module, exports);
tslib_1.__exportStar(require("./xtra_module"), exports);
`,
contents: `var tslib_1 = require("tslib");\n` +
`var b_module = require("./b_module");\n` +
`tslib_1.__exportStar(b_module, exports);\n` +
`tslib_1.__exportStar(require("./xtra_module"), exports);\n`,
},
];

View File

@ -570,107 +570,99 @@ runInEachFileSystem(() => {
EXPORTS_FILES = [
{
name: _('/index.js'),
contents: `
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./a_module'), require('./b_module'), require('./wildcard_reexports'), require('./wildcard_reexports_imported_helpers'), require('./wildcard_reexports_with_require')) :
typeof define === 'function' && define.amd ? define('index', ['exports', './a_module', './b_module', './wildcard_reexports', './wildcard_reexports_imported_helpers', './wildcard_reexports_with_require'], factory) :
(factory(global.index, global.a_module, global.b_module, global.wildcard_reexports, global.wildcard_reexports_imported_helpers, global.wildcard_reexports_with_require));
}(this, (function (exports, a_module, b_module, wildcard_reexports, wildcard_reexports_imported_helpers, wildcard_reexports_with_require) { 'use strict';
})));
`
contents: `(function (global, factory) {\n` +
` typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./a_module'), require('./b_module'), require('./wildcard_reexports'), require('./wildcard_reexports_imported_helpers'), require('./wildcard_reexports_with_require')) :\n` +
` typeof define === 'function' && define.amd ? define('index', ['exports', './a_module', './b_module', './wildcard_reexports', './wildcard_reexports_imported_helpers', './wildcard_reexports_with_require'], factory) :\n` +
` (factory(global.index, global.a_module, global.b_module, global.wildcard_reexports, global.wildcard_reexports_imported_helpers, global.wildcard_reexports_with_require));\n` +
`}(this, (function (exports, a_module, b_module, wildcard_reexports, wildcard_reexports_imported_helpers, wildcard_reexports_with_require) { 'use strict';\n` +
`})));\n`
},
{
name: _('/a_module.js'),
contents: `
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define('a_module', ['exports'], factory) :
(factory(global.a_module));
}(this, (function (exports) { 'use strict';
var a = 'a';
exports.a = a;
})));`,
contents: `(function (global, factory) {\n` +
` typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n` +
` typeof define === 'function' && define.amd ? define('a_module', ['exports'], factory) :\n` +
` (factory(global.a_module));\n` +
`}(this, (function (exports) { 'use strict';\n` +
` var a = 'a';\n` +
` exports.a = a;\n` +
`})));\n`,
},
{
name: _('/b_module.js'),
contents: `
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('/a_module')) :
typeof define === 'function' && define.amd ? define('b_module', ['exports', '@angular/core', 'a_module'], factory) :
(factory(global.b_module));
}(this, (function (exports, core, a_module) { 'use strict';
var b = a_module.a;
var e = 'e';
var SomeClass = (function() {
function SomeClass() {}
return SomeClass;
}());
exports.Directive = core.Directive;
exports.a = a_module.a;
exports.b = b;
exports.c = a_module.a;
exports.d = b;
exports.e = e;
exports.DirectiveX = core.Directive;
exports.SomeClass = SomeClass;
})));`,
contents: `(function (global, factory) {\n` +
` typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('/a_module')) :\n` +
` typeof define === 'function' && define.amd ? define('b_module', ['exports', '@angular/core', 'a_module'], factory) :\n` +
` (factory(global.b_module));\n` +
`}(this, (function (exports, core, a_module) { 'use strict';\n` +
` var b = a_module.a;\n` +
` var e = 'e';\n` +
` var SomeClass = (function() {\n` +
` function SomeClass() {}\n` +
` return SomeClass;\n` +
` }());\n` +
`\n` +
` exports.Directive = core.Directive;\n` +
` exports.a = a_module.a;\n` +
` exports.b = b;\n` +
` exports.c = a_module.a;\n` +
` exports.d = b;\n` +
` exports.e = e;\n` +
` exports.DirectiveX = core.Directive;\n` +
` exports.SomeClass = SomeClass;\n` +
`})));\n`,
},
{
name: _('/xtra_module.js'),
contents: `
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define('xtra_module', ['exports'], factory) :
(factory(global.xtra_module));
}(this, (function (exports) { 'use strict';
var xtra1 = 'xtra1';
var xtra2 = 'xtra2';
exports.xtra1 = xtra1;
exports.xtra2 = xtra2;
})));`,
contents: `(function (global, factory) {\n` +
` typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n` +
` typeof define === 'function' && define.amd ? define('xtra_module', ['exports'], factory) :\n` +
` (factory(global.xtra_module));\n` +
`}(this, (function (exports) { 'use strict';\n` +
` var xtra1 = 'xtra1';\n` +
` var xtra2 = 'xtra2';\n` +
` exports.xtra1 = xtra1;\n` +
` exports.xtra2 = xtra2;\n` +
`})));\n`,
},
{
name: _('/wildcard_reexports.js'),
contents: `
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./b_module'), require('./xtra_module')) :
typeof define === 'function' && define.amd ? define('wildcard_reexports', ['exports', './b_module', './xtra_module'], factory) :
(factory(global.wildcard_reexports, b_module, xtra_module));
}(this, (function (exports, b_module, xtra_module) { 'use strict';
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(b_module);
__export(xtra_module);
})));`,
contents: `(function (global, factory) {\n` +
` typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./b_module'), require('./xtra_module')) :\n` +
` typeof define === 'function' && define.amd ? define('wildcard_reexports', ['exports', './b_module', './xtra_module'], factory) :\n` +
` (factory(global.wildcard_reexports, b_module, xtra_module));\n` +
`}(this, (function (exports, b_module, xtra_module) { 'use strict';\n` +
` function __export(m) {\n` +
` for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n` +
` }\n` +
` __export(b_module);\n` +
` __export(xtra_module);\n` +
`})));\n`,
},
{
name: _('/wildcard_reexports_imported_helpers.js'),
contents: `
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('./b_module'), require('./xtra_module')) :
typeof define === 'function' && define.amd ? define('wildcard_reexports', ['exports', 'tslib', './b_module', './xtra_module'], factory) :
(factory(global.wildcard_reexports_imported_helpers, tslib, b_module, xtra_module));
}(this, (function (exports, tslib, b_module, xtra_module) { 'use strict';
tslib.__exportStar(b_module, exports);
tslib.__exportStar(xtra_module, exports);
})));`,
contents: `(function (global, factory) {\n` +
` typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('./b_module'), require('./xtra_module')) :\n` +
` typeof define === 'function' && define.amd ? define('wildcard_reexports', ['exports', 'tslib', './b_module', './xtra_module'], factory) :\n` +
` (factory(global.wildcard_reexports_imported_helpers, tslib, b_module, xtra_module));\n` +
`}(this, (function (exports, tslib, b_module, xtra_module) { 'use strict';\n` +
` tslib.__exportStar(b_module, exports);\n` +
` tslib.__exportStar(xtra_module, exports);\n` +
`})));\n`,
},
{
name: _('/wildcard_reexports_with_require.js'),
contents: `
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require, exports) :
typeof define === 'function' && define.amd ? define('wildcard_reexports_with_require', ['require', 'exports'], factory);
}(this, (function (require, exports) { 'use strict';
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var b_module = require('./b_module');
__export(b_module);
__export(require('./xtra_module'));
})));`,
contents: `(function (global, factory) {\n` +
` typeof exports === 'object' && typeof module !== 'undefined' ? factory(require, exports) :\n` +
` typeof define === 'function' && define.amd ? define('wildcard_reexports_with_require', ['require', 'exports'], factory);\n` +
`}(this, (function (require, exports) { 'use strict';\n` +
` function __export(m) {\n` +
` for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n` +
` }\n` +
` var b_module = require('./b_module');\n` +
` __export(b_module);\n` +
` __export(require('./xtra_module'));\n` +
`})));\n`,
}
];