Skip to content

Commit

Permalink
Enabled compiler test for runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
cshawaus committed Oct 8, 2020
1 parent fd9bfae commit 8039e42
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/runtime.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ describe('runtime', () => {

// Parent configuration
[resolve('../pom.xml')]: mockFS.load(resolve('parent.pom.xml', fixturesPath)),

// Webpack entry file
[resolve('mock/js/basic-es6.js')]: mockFS.load(resolve('mock/basic-es6.js', fixturesPath)),
}

// NOTE: This next bit is required in order to map 'node_modules' while 'mock-fs' is used, this is because 'mock-fs' returns 'null' everytime 'require' is used. It does add an extended period of time during test suite runs due to the amount of modules needing to be loaded.
Expand Down Expand Up @@ -129,7 +132,7 @@ describe('runtime', () => {
expect(config.output.chunkFilename).toContain('[contenthash:8]')
})

xtest('can compile es6 javascript entry', async (done) => {
test('can compile es6 javascript entry', async (done) => {
const config = configuration(composeConfiguration({
standard: {
projects: {
Expand All @@ -150,7 +153,10 @@ describe('runtime', () => {

expect(stats.hasErrors()).toBe(false)

console.log(memoryFileSystem.readdirSync('.'))
const fileSystemOutput = memoryFileSystem.readdirSync('public/mock/clientlibs-footer/js')

expect(fileSystemOutput).toHaveLength(1)
expect(fileSystemOutput).toStrictEqual(['mock.js'])

done()
})
Expand Down
6 changes: 1 addition & 5 deletions test/helpers/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import path from 'path'

import {
ComposeConfiguration,
RuntimeConfiguration,
Expand All @@ -11,16 +9,14 @@ import {

import runtime from '@/runtime'

const fixturesPath = path.resolve(__dirname, '../fixtures')

export function composeConfiguration(config: Partial<ComposeConfiguration>): Partial<ComposeConfiguration> {
return {
standard: {
mergeProjects: false,
},

webpack: {
context: fixturesPath,
context: process.cwd(),
},

...config,
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/lazy-load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import mockFS from 'mock-fs'

import type FileSystem from 'mock-fs/lib/filesystem'

function lazyLoadNodeModules(mockedFileSystem: FileSystem.DirectoryItems, from: string, depth = 6): void {
function lazyLoadNodeModules(mockedFileSystem: FileSystem.DirectoryItems, from: string, depth = 10): void {
const stat = fs.lstatSync(from)

if (stat.isDirectory() && depth > 0) {
Expand Down

0 comments on commit 8039e42

Please sign in to comment.