Home

Awesome

Organisation Flapdoodle OSS

We are now a github organisation. You are invited to participate.

Embedded node.js

Embedded node.js will provide a platform neutral way for running node binary in unittests.

Why?

Howto

Maven

Stable (Maven Central Repository, Released: 06.10.2013 - wait 24hrs for maven central)

<dependency>
	<groupId>de.flapdoodle.embed</groupId>
	<artifactId>de.flapdoodle.embed.nodejs</artifactId>
	<version>1.28</version>
</dependency>

Snapshots (Repository http://oss.sonatype.org/content/repositories/snapshots)

<dependency>
	<groupId>de.flapdoodle.embed</groupId>
	<artifactId>de.flapdoodle.embed.nodejs</artifactId>
	<version>1.29-SNAPSHOT</version>
</dependency>

Changelog

Initial Version starts with 1.19 SNAPSHOT as extract from Embedded MongoDB Project

1.28 (SNAPSHOT)

1.28 (SNAPSHOT)

1.27

1.26

1.25

1.24

1.23

1.22

1.21

1.20

1.19

1.18

Supported Versions

Versions: 0.8.6, any custom Support for Linux, Windows and MacOSX.

Usage

Running javascript from junit test with node.js

public void testNodejs() throws IOException, InterruptedException {
	final File helloWorld = Files.createTempFile("node-hello-world.js");
	Files.write("console.log(\"Running Hello World inside NodeJS in \"+process.cwd());setTimeout(function(){},1000);", helloWorld);
	try {
		Nodejs.call(NodejsVersion.Main.V0_8, helloWorld.getAbsolutePath(), System.getProperty("java.io.tmpdir"));
	} finally {
		Files.forceDelete(helloWorld);
	}
}