react-native-storybook-loader
Advanced tools
Comparing version 1.7.0 to 1.8.0
{ | ||
"name": "react-native-storybook-loader", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"repository": "https://github.com/elderfo/react-native-storybook-loader.git", | ||
@@ -5,0 +5,0 @@ "bugs": "https://github.com/elderfo/react-native-storybook-loader/issues", |
@@ -26,14 +26,8 @@ const logger = require('./logger'); | ||
if (storyFiles.length > 0) { | ||
const sortedFiles = sortFiles(storyFiles); | ||
writeFile(sortedFiles, outputFileConfig.outputFile); | ||
logger.info( | ||
`Compiled story loader for ${storyFiles.length} files:\n`, | ||
` ${storyFiles.join('\n ')}` | ||
); | ||
} else { | ||
logger.warn( | ||
'No files were found matching the specified pattern. Story loader was not written.' | ||
); | ||
} | ||
const sortedFiles = sortFiles(storyFiles); | ||
writeFile(sortedFiles, outputFileConfig.outputFile); | ||
logger.info( | ||
`Compiled story loader for ${storyFiles.length} files:\n`, | ||
` ${storyFiles.join('\n ')}` | ||
); | ||
}); | ||
@@ -40,0 +34,0 @@ }; |
@@ -27,3 +27,3 @@ const faker = require('faker'); | ||
const secondFiles = generateArray(faker.system.fileName); | ||
const thirdFiles = generateArray(faker.system.fileName); | ||
const noFiles = []; | ||
@@ -33,3 +33,3 @@ storyFinder.loadStories | ||
.mockImplementationOnce(() => secondFiles) | ||
.mockImplementationOnce(() => thirdFiles); | ||
.mockImplementationOnce(() => noFiles); | ||
@@ -53,5 +53,5 @@ writeOutStoryLoader(config); | ||
expect(writer.writeFile).toHaveBeenCalledWith( | ||
thirdFiles.concat().sort(), | ||
noFiles.concat().sort(), | ||
config.outputFiles[1].outputFile | ||
); | ||
}); |
@@ -23,3 +23,3 @@ const mock = require('mock-fs'); | ||
test('writeFile should perform expected work', () => { | ||
test('writeFile generate story loader', () => { | ||
const files = [ | ||
@@ -38,1 +38,10 @@ path.resolve(__dirname, '../file1.js'), | ||
}); | ||
test('writeFile should generate dummy story loader if no stories were found', () => { | ||
const files = []; | ||
writeFile(files, outputPath, moduleDir); | ||
const contents = fs.readFileSync(outputPath, encoding); | ||
expect(contents).toMatchSnapshot(); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192970