
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Helper library to assist smoke-testing of the bem technologies
npm install bem-smoke
You need to require bem-smoke
module and call testTech
method with a path to your
technology module:
var BEMSmoke = require('bem-smoke');
var tech = BEMSmoke.testTech('/absolute/path/to/tech');
You can use require.resolve
to get an absolute path from module id.
All TechTest
modules can be divided into three groups that should be called in order:
var tech = BEMTesting.testTech(require.resolve('path/to/css-tech'));
tech.withSourceFiles({
'menu': {
'menu.css': '.test1 {}',
'__item': {
'menu__item.css': '.test2 {}'
}
}
})
.build('/name', {
deps: [
{block: 'menu'},
{block: 'menu', elem: 'item'}
]
})
.producesFile('name.css')
.withContent('@import url(menu/menu.css);',
'@import url(menu/__item/menu__item.css);',
'');
withSourceFiles(fsTree)
- specifies how FS tree should look like during a test. Keys of fsTree
represent
files/directories names. If value of a key is an object, then it represents directory, if it's string or Buffer -
file with corresponding content.
withLevel(path)
- specify level to use during the test. If not called, level at root of a mock fs tree will
be used.
withLevels(levels)
- specifies levels to use for a create/bulid. levels
is an array of directory paths.
withTechMap(map)
- specifies tech map to use during tests. Map format is
{"techName": "/absolute/path/to/module"}
. Can be useful to resolve base technologies by names.
withMockModules(modules)
- specifies mocks to use instead of particular modules during the test. Format is
{"moduleId": mockObject}
. Note, that fs
and q-io/fs
modules are already mocked by framework.
Example:
tech.withMockedModules({
'net': {
createServer: function() {
...
}
}
});
withMockedModulesResolves(modulePaths)
- stub require.resolve
for tech under the test to return
specified path instead of original. Doesn't affect actual module loaded via require
. Format is
{"moduleId": "/stub/path"}
.
touchFile(path)
- updates access and modification dates for file at path
. Should be called after
build
or create
.
create(elem)
- performs create action for the technology. elem.block
, elem.elem
, elem.mod
and elem.val
specifies entity to create.
build(prefix, decl)
- performs build action. prefix
specifies output path prefix, decl
- declaration
to use for a build.
producesFile(path)
- assert that file at path
exists after action finishes.withContent(line1, line2, ...)
- assert that file specified at the last producesFile
has correct content
after action finishes. Each argument represents one expected line of a file.writesToFile(path)
- assert that file at path
have been written to during the test.notWritesToFile(path)
- assert that file at path
have not been written to during test.notify(callback)
- used with asynchronous test runners, such as mocha
to notify runner that test is complete.asserts(callback)
- pass a function to this method to execute any additional assertions on a tech.Example:
describe('example', function() {
it('completes', function(done) {
tech.withSourceFiles({
})
...
.notify(done);
});
});
Licensed under MIT license.
0.3.2
fs.lstatSync
mock.FAQs
Helper library to assist smoke-testing of the bem technologies.
The npm package bem-smoke receives a total of 3 weekly downloads. As such, bem-smoke popularity was classified as not popular.
We found that bem-smoke demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.